package com.szholly.pro.watergas_server.ps.android.controller;

import com.szholly.pro.watergas_server.ps.android.common.ValidUtils;

public class AndroidPageInfo {
	private int count;
    private int pageSize;
    private int pageCount;
    private int pageIndex;
    
    public static AndroidPageInfo create(int count,int pageSize,int pageIndex) throws Exception{
    	ValidUtils.isTrue(count>=0,"PageInfo count < 0");
    	ValidUtils.isTrue(pageSize>=1,"PageInfo pageSize < 1");
    	ValidUtils.isTrue(pageIndex>=1,"PageInfo pageIndex < 1");
    	AndroidPageInfo info = new AndroidPageInfo();
    	info.pageCount = (count+pageSize-1)/pageSize;
    	info.count = count;
    	info.pageSize = pageSize;
    	info.pageIndex = pageIndex;
    	return info;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageCount() {
        return pageCount;
    }

    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }

    public int getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
    }
}
